/*
 * @Author: Hzt
 * @Date: 2023-07-17 09:29:22
 * @LastEditTime: 2024-06-24 22:30:56
 * @LastEditors: Hzt
 * @Description: 
 * @FilePath: /cty_admin/src/utils/js-beautif-libs/actions.js
 */
export function _recurseGetRoute(routes, menuNames) {
  const filterMenu = [];
  routes.forEach(item => {
    const findMenu = menuNames.find(i => i.code === item.name);
    if (findMenu) {
      if (item.meta) {
        item.meta.title = findMenu.name;
      }
      item.order = findMenu.order;
      if (item.children && item.children.length > 0) {
        item.children = _recurseGetRoute(item.children, menuNames).sort(
          (a, b) => (a.order ? a.order - b.order : -1)
        );
      }
      filterMenu.push(item);
    }
  });
  return filterMenu;
}

